package net.huashitong.goodinfo.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import com.sirdc.modules.utils.StringUtils;
import net.huashitong.goodinfo.entity.GoodsInfo;
import net.huashitong.goodinfo.filter.GoodsInfoFilter;
import net.huashitong.goodsclass.entity.GoodsClasses;
import net.huashitong.goodsclass.filter.GoodsClassFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class GoodsInfoDao extends StringDao<GoodsInfo> {
    public List<GoodsInfo> query(GoodsInfoFilter filter)
    {
        GenericQuery query = createQuery("obj");
        if (StringUtils.isNotBlank(filter.getClaName())) {
            query.append(" and obj.goodName like :goodName");
            query.setParam("goodName", StringUtils.getLikewords(filter.getClaName()));
        }
        return query.listResult(filter);

    }
}
